﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CadastroProjetos.aspx.cs" Inherits="WebApp_Scrum.CadastroProjetos" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="gvProjetos" runat="server" AutoGenerateColumns="False" 
            CellPadding="4" DataKeyNames="CodigoProjeto" DataSourceID="odsProjetos" 
            ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="CodigoProjeto" HeaderText="CodigoProjeto" 
                    SortExpression="CodigoProjeto" />
                <asp:BoundField DataField="NomeProjeto" HeaderText="NomeProjeto" 
                    SortExpression="NomeProjeto" />
                <asp:BoundField DataField="ObjetivoProjeto" HeaderText="ObjetivoProjeto" 
                    SortExpression="ObjetivoProjeto" />
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
        </asp:GridView>
        <asp:ObjectDataSource ID="odsProjetos" runat="server" 
            OldValuesParameterFormatString="original_{0}" SelectMethod="Listar" 
            TypeName="BLL.ProjetosBLL">
        </asp:ObjectDataSource>
        <br />
        <asp:Button ID="btnNovoProjeto" runat="server" Text="Novo projeto" 
            onclick="btnNovoProjeto_Click" />
        <br />
        <br />
        <asp:FormView ID="frvProjetos" runat="server" DataSourceID="odsProjetosDetails" 
            CellPadding="4" ForeColor="#333333" onitemdeleted="FormView1_ItemDeleted" 
            oniteminserted="FormView1_ItemInserted" 
            onitemupdated="FormView1_ItemUpdated" 
            onpageindexchanging="frvProjetos_PageIndexChanging">
            <EditItemTemplate>
                <asp:TextBox ID="CodigoProjetoTextBox" runat="server" visible="false"
                    Text='<%# Bind("CodigoProjeto") %>' />                
                NomeProjeto:
                <asp:TextBox ID="NomeProjetoTextBox" runat="server" 
                    Text='<%# Bind("NomeProjeto") %>' />
                <br />
                ObjetivoProjeto:
                <asp:TextBox ID="ObjetivoProjetoTextBox" runat="server" 
                    Text='<%# Bind("ObjetivoProjeto") %>' />
                <br />
                <asp:Button ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Salvar" />
                &nbsp;<asp:Button ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
            </EditItemTemplate>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <InsertItemTemplate>
                <asp:TextBox ID="CodigoProjetoTextBox" runat="server" visible="false"
                    Text='<%# Bind("CodigoProjeto") %>' />                
                NomeProjeto:
                <asp:TextBox ID="NomeProjetoTextBox" runat="server" 
                    Text='<%# Bind("NomeProjeto") %>' />
                <br />
                ObjetivoProjeto:
                <asp:TextBox ID="ObjetivoProjetoTextBox" runat="server" 
                    Text='<%# Bind("ObjetivoProjeto") %>' />
                <br />
                <asp:Button ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Inserir" />
                &nbsp;<asp:Button ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
            </InsertItemTemplate>
            <ItemTemplate>
                <asp:TextBox ID="CodigoProjetoTextBox" runat="server" visible="false"
                    Text='<%# Bind("CodigoProjeto") %>' />                
                NomeProjeto:
                <asp:Label ID="NomeProjetoLabel" runat="server" 
                    Text='<%# Bind("NomeProjeto") %>' />
                <br />
                ObjetivoProjeto:
                <asp:Label ID="ObjetivoProjetoLabel" runat="server" 
                    Text='<%# Bind("ObjetivoProjeto") %>' />
                <br />
                <asp:Button ID="EditButton" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="Editar" />
                &nbsp;<asp:Button ID="DeleteButton" runat="server" CausesValidation="False" 
                    CommandName="Delete" Text="Excluir" />
            </ItemTemplate>
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
        </asp:FormView>
        <asp:ObjectDataSource ID="odsProjetosDetails" runat="server" 
            DataObjectTypeName="Models.Projetos" DeleteMethod="Excluir"  
            OldValuesParameterFormatString="original_{0}" SelectMethod="Ler"             
            TypeName="BLL.ProjetosBLL" 
            UpdateMethod="Alterar" InsertMethod="Incluir" >
            <DeleteParameters>
                <asp:Parameter Name="CodigoProjeto" Type="Int32" />
            </DeleteParameters>

            <SelectParameters>
                <asp:ControlParameter ControlID="gvProjetos" Name="CodigoProjeto" 
                    PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <br />
        <br />
        <br />
    </div>
    </form>
</body>
</html>
